<%- @page_title = _('Editing User %s', h(@user.name)) -%>
<h2><%= @page_title %></h2>
<%- form_for( :user, @user,
              :url => user_path(@user),
              :html => {:class => 'form-small',
                        :method => :put,
                        :onsubmit => "Field.disable('submit-form'); Element.hide('cancel-form');"}) do |f| -%>
  <div class="form"><!--O .form-->
    <label for="user_name"><%= _('Name') %>:</label>
    <%= f.text_field(:name, :class => 'textfield') %>
    <%= error_message_on(:user, :name) %>
  </div><!--C .form-->
  <div class="form"><!--O .form-->
    <label for="user_email"><%= _('Email') %>:</label>
    <%= f.text_field(:email, :class => 'textfield') %>
    <%= error_message_on(:user, :email) %>
  </div><!--C .form-->
  <%- if @logged_user.is_teacher? -%>
    <div class="form"><!--O .form-->
      <%= f.check_box(:is_teacher, :class => 'checkbox') %>
      <label for="user_is_teacher" class="for-checkbox"><%= _('Is a teacher') %></label>
      <%= error_message_on(:user, :is_teacher) %>
    </div><!--C .form-->
  <%- end -%>
  <hr />
  <h3>Change Password</h3>
  <div class="form"><!--O .form-->
    <label for="user_password"><%= _("New Password") %>:</label>
    <%= f.password_field(:password, :class => 'textfield') %>
    <%= error_message_on(:user, :password) %>
  </div><!--C .form-->
  <div class="form"><!--O .form-->
    <label for="user_password_confirmation"><%= _("Confirm New Password") %>:</label>
    <%= f.password_field(:password_confirmation, :class => 'textfield') %>
    <%= error_message_on(:user, :password_confirmation) %>
  </div><!--C .form-->
  <hr />
  <div class="form"><!--O .form-->
    <%= submit_tag(_('Save Details'), :class => 'button', :id => 'submit-form') %>
    <%- if @logged_user.is_teacher? -%>
      <%= link_to(_('&laquo; Back to user'), user_path(@user), :id => 'cancel-form') %>
    <%- end -%>
  </div><!--C .form-->
<%- end -%>